<template>
  <div>
    <h2>机构管理</h2>
    <br />
    <el-row>
      <el-col :span="7"
        >机构名称：<el-input
          v-model="searchForm.institutionName"
          style="width: 240px"
          placeholder=""
      /></el-col>
      <el-col :span="7"
        >机构状态：<el-input
          v-model="searchForm.institutionStatus"
          style="width: 240px"
          placeholder=""
      /></el-col>
      <el-col :span="10"
        >添加日期：<el-input
          v-model="searchForm.createTime"
          style="width: 240px"
          placeholder=""
      /></el-col>
    </el-row>
    <br>
    <el-row>
      <el-col :span="7"
        >上报日期：<el-input
          v-model="searchForm.escalationTime"
          style="width: 240px"
          placeholder=""
      /></el-col>
      <el-col :span="3"
        ><el-button type="primary" round>查询</el-button></el-col
      >
    </el-row>
    <br>
    <vxe-toolbar>
      <template #buttons>
        <vxe-button
          status="primary"
          icon="vxe-icon-square-plus"
          @click="adddialogVisible = true"
          >新增</vxe-button
        >
      </template>
    </vxe-toolbar>
    <el-table :data="tableData" height="300" border style="width: 100%">
      <el-table-column
        prop="institutionName"
        label="机构名称"
        width="200"
        align="center"
      />
      <el-table-column prop="address" label="地址" width="240" align="center" />
      <el-table-column prop="phone" label="联系电话" width="160" align="center" />
      <el-table-column prop="header" label="负责人" width="120" align="center" />
      <el-table-column
        prop="headerPhone"
        label="负责人电话"
        width="160"
        align="center"
      />
      <el-table-column
        prop="createTime"
        label="添加日期"
        width="160"
        align="center"
      />
      <el-table-column label="操作" width="200" header-align="center" />
    </el-table>
  </div>
  <!-- 新增对话框 -->
  <el-dialog v-model="adddialogVisible" title="新增机构" width="600">
    <el-form
      ref="ruleFormRef"
      style="max-width: 600px"
      :model="ruleForm"
      :rules="rules"
      label-width="auto"
      class="demo-ruleForm"
      :size="formSize"
      status-icon
    >
      <el-row>
        <el-col :span="12">
          <el-form-item label="机构名称" prop="institutionName">
            <el-input v-model="ruleForm.institutionName" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="机构编码" prop="institutionCode">
            <el-input v-model="ruleForm.institutionCode" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="入住类别" prop="checkInType">
            <el-input v-model="ruleForm.checkInType" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="邮政编码" prop="postalCode">
            <el-input v-model="ruleForm.postalCode" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-form-item label="级别" prop="level">
        <el-input v-model="ruleForm.level"></el-input>
      </el-form-item>
      <el-form-item label="性质" prop="nature">
        <el-input v-model="ruleForm.nature"></el-input>
      </el-form-item>
      <el-row>
        <el-col :span="12">
          <el-form-item label="行政区划" prop="administrativeDivision">
            <el-input v-model="ruleForm.phone" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="联系电话" prop="phone">
            <el-input v-model="ruleForm.phone" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="地址" prop="address">
            <el-input v-model="ruleForm.address" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="负责人" prop="header">
            <el-input v-model="ruleForm.header" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="负责人电话" prop="headerPhone">
            <el-input v-model="ruleForm.headerPhone" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="24">
          <el-form-item label="医院简介" prop="aboutUs">
            <el-input v-model="ruleForm.aboutUs" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="24">
          <el-form-item label="科室介绍" prop="departDescription">
            <el-input v-model="ruleForm.departDescription" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="签约时间" prop="signingTime">
            <el-input v-model="ruleForm.signingTime" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="签约年限" prop="signingYears">
            <el-input v-model="ruleForm.signingYears" />
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <template #footer>
      <div class="dialog-footer" style="text-align: center">
        <el-button type="primary" @click="doAdd"> 保存 </el-button>
      </div>
    </template>
  </el-dialog>
</template>
  
  
<script setup>
import { ref, reactive } from "vue";
const adddialogVisible = ref(false);
const tableData = [
  {
    createTime: "2016-05-03",
    name: "Tom",
  },
  {
    createTime: "2016-05-02",
    name: "Tom",
    address: "No. 189, Grove St, Los Angeles",
  },
  {
    createTime: "2016-05-04",
    name: "Tom",
    address: "No. 189, Grove St, Los Angeles",
  },
  {
    createTime: "2016-05-01",
    name: "Tom",
    address: "No. 189, Grove St, Los Angeles",
  },
  {
    createTime: "2016-05-08",
    name: "Tom",
    address: "No. 189, Grove St, Los Angeles",
  },
  {
    createTime: "2016-05-06",
    name: "Tom",
    address: "No. 189, Grove St, Los Angeles",
  },
  {
    createTime: "2016-05-07",
    name: "Tom",
    address: "No. 189, Grove St, Los Angeles",
  },
];
const doAdd = async () => {
  adddialogVisible.value = false;
};

const formSize = ref("default");
const ruleFormRef = ref();
const searchForm = reactive({});
const ruleForm = reactive({
  username: "",
  password: "",
  name: "",
  sex: "",
  idCard: "",
  phone: "",
  birthday: "",
  title: "",
  role: "",
  campur: "",
  department: "",
  state: "",
});

const rules = reactive({
  // name: [
  //   { required: true, message: "Please input Activity name", trigger: "blur" },
  //   { min: 3, max: 5, message: "Length should be 3 to 5", trigger: "blur" },
  // ],
  region: [
    {
      required: true,
      message: "Please select Activity zone",
      trigger: "change",
    },
  ],
  count: [
    {
      required: true,
      message: "Please select Activity count",
      trigger: "change",
    },
  ],
  date1: [
    {
      type: "date",
      required: true,
      message: "Please pick a date",
      trigger: "change",
    },
  ],
  date2: [
    {
      type: "date",
      required: true,
      message: "Please pick a time",
      trigger: "change",
    },
  ],
  type: [
    {
      type: "array",
      required: true,
      message: "Please select at least one activity type",
      trigger: "change",
    },
  ],
  resource: [
    {
      required: true,
      message: "Please select activity resource",
      trigger: "change",
    },
  ],
  desc: [
    { required: true, message: "Please input activity form", trigger: "blur" },
  ],
});

const submitForm = async (formEl) => {
  if (!formEl) return;
  await formEl.validate((valid, fields) => {
    if (valid) {
      console.log("submit!");
    } else {
      console.log("error submit!", fields);
    }
  });
};

const resetForm = (formEl) => {
  if (!formEl) return;
  formEl.resetFields();
};

const options = Array.from({ length: 10000 }).map((_, idx) => ({
  value: `${idx + 1}`,
  label: `${idx + 1}`,
}));
</script>
  
  
<style scoped>
</style>